package com.situ.servlet;

import com.situ.entity.User;
import com.situ.service.UserService;
import com.situ.util.BaseServlet;
import com.situ.util.Param;
import com.situ.vo.TableVO;

import javax.servlet.annotation.WebServlet;

@WebServlet("/user")
public class UserServlet extends BaseServlet {
    UserService service = new UserService();

    //打开用户页面
    public String page() {
        return "user";
    }

    //查询用户数据返回
    public TableVO select(@Param("page") Integer page, @Param("limit") Integer limit, @Param("username") String username, @Param("tel") String tel) {
        return service.select(page, limit, username, tel);
    }

    //根据ID删除用户
    public void delete(@Param("uid") String uid) {
        service.delete(uid);
    }

    //保存用户
    public void save(User u) {
        service.save(u);
    }

    //根据ID获取用户信息
    public User info(@Param("uid") Integer uid) {
        return service.info(uid);
    }


    public void role(@Param("type") String type, @Param("uid") Integer uid, @Param("rid") Integer rid) {
        service.role(type, uid, rid);
    }
}
